package com.it.hanzhongtravelv1.entity;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.JsonBackReference;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "route_days")
public class RouteDay {

    public enum ScheduleGranularity {
        TIME_POINT, // e.g., 08:30, 11:00
        TIME_SLOT,  // e.g., 上午, 下午
        DAILY       // e.g., 全天, or just a summary for the day
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private int dayNumber;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "travel_route_id")
    @JsonBackReference("route-days")
    private TravelRoute travelRoute;

    @OneToMany(mappedBy = "routeDay", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
    @JsonManagedReference("day-activities")
    private List<DayActivity> activities = new ArrayList<>();

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getDayNumber() {
        return dayNumber;
    }

    public void setDayNumber(int dayNumber) {
        this.dayNumber = dayNumber;
    }

    public TravelRoute getTravelRoute() {
        return travelRoute;
    }

    public void setTravelRoute(TravelRoute travelRoute) {
        this.travelRoute = travelRoute;
    }

    public List<DayActivity> getActivities() {
        return activities;
    }

    public void setActivities(List<DayActivity> activities) {
        this.activities = activities;
    }
} 